import os
from qdrant.tool import multiply

os.environ["LANGSMITH_TRACING"] = "true"
# os.environ["LANGSMITH_API_KEY"] = getpass.getpass()
os.environ["LANGSMITH_API_KEY"] = "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"

from langchain.chat_models import init_chat_model

model = init_chat_model(
    model_provider="openai",
    model="qwen/qwq-32b:free",
    base_url="https://openrouter.ai/api/v1",
    api_key="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",
)

# model.invoke("你好~")

# response = model.invoke([HumanMessage(content="你好!")])
# print("response", response)

# 工具
tools = [multiply]
model_with_tools = model.bind_tools(tools)

# response = model_with_tools.invoke([HumanMessage(content="1x2是多少？")])
# response = model_with_tools.invoke("1 乘以 2 等于多少？")
response = model_with_tools.invoke("你好")

print(f"ContentString: {response.content}")
print(f"ToolCalls: {response.tool_calls}")
